'\" te
.\" This manual page is derived from the DAT/uDAPL 1.2 specification.
.\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DAT_EP_POST_RECV 3DAT "Jul 16, 2004"
.SH NAME
dat_ep_post_recv \- receive data over the connection of the Endpoint
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-ldat\fR [ \fIlibrary\fR\&.\|.\|. ]
#include <\fBdat/udat.h\fR>

DAT_RETURN
    dat_ep_post_recv (
    IN    DAT_EP_HANDLE        ep_handle,
    IN    DAT_COUNT            num_segments,
    IN    DAT_LMR_TRIPLET      *local_iov,
    IN    DAT_DTO_COOKIE       user_cookie,
    IN    DAT_COMPLETION_FLAGS completion_flags
    )
.fi

.SH PARAMETERS
.ne 2
.na
\fB\fIep_handle\fR\fR
.ad
.RS 20n
Handle for an instance of the Endpoint.
.RE

.sp
.ne 2
.na
\fB\fInum_segments\fR\fR
.ad
.RS 20n
Number of \fIlmr_triplets\fR in \fIlocal_iov\fR. Can be 0 for receiving a 0
size message.
.RE

.sp
.ne 2
.na
\fB\fIlocal_iov\fR\fR
.ad
.RS 20n
I/O Vector that specifies the local buffer to be filled. Can be \fINULL\fR for
receiving a 0 size message.
.RE

.sp
.ne 2
.na
\fB\fIuser_cookie:\fR\fR
.ad
.RS 20n
User-provided cookie that is returned to the Consumer at the completion of the
Receive DTO. Can be \fINULL\fR.
.RE

.sp
.ne 2
.na
\fB\fIcompletion_flags\fR\fR
.ad
.RS 20n
Flags for posted Receive. The default \fBDAT_COMPLETION_DEFAULT_FLAG\fR is
0x00. Other values are as follows:
.sp
.ne 2
.na
\fBNotification of Completion\fR
.ad
.RS 30n
\fBDAT_COMPLETION_UNSIGNALLED_FLAG\fR
.sp
.ne 2
.na
\fB0x04\fR
.ad
.RS 8n
Non-notification completion. Local Endpoint must be configured for Unsignaled
CompletionNotification Suppression.
.RE

.RE

.RE

.SH DESCRIPTION
.LP
The \fBdat_ep_post_recv()\fR function requests the receive of the data over the
connection of the \fIep_handle\fR Endpoint of the incoming message into the
\fIlocal_iov\fR.
.sp
.LP
The \fInum_segments\fR parameter specifies the number of segments in the
\fIlocal_iov\fR. The \fIlocal_iov\fR segments are filled in the I/O Vector
order until the whole message is received. This ensures that all the "front"
segments of the \fIlocal_iov\fR I/O Vector are completely filled, only one
segment is partially filled, if needed, and all segments that follow it are not
filled at all.
.sp
.LP
The \fIuser_cookie\fR allows Consumers to have unique identifiers for each DTO.
These identifiers are completely under user control and are opaque to the
Provider. There is no requirement on the Consumer that the value
\fIuser_cookie\fR should be unique for each DTO. The \fIuser_cookie\fR is
returned to the Consumer in the Completion event for the posted Receive.
.sp
.LP
The completion of the posted Receive is reported to the Consumer asynchronously
through a DTO Completion event based on the configuration of the connection for
Solicited Wait and the specified \fIcompletion_flags\fR value for the matching
Send. The value of \fBDAT_COMPLETION _UNSIGNALLED_FLAG\fR is only valid if the
Endpoint Recv Completion Flags \fBDAT_COMPLETION_UNSIGNALLED_FLAG\fR.
Otherwise, \fBDAT_INVALID_PARAMETER\fR is returned.
.sp
.LP
A Consumer must not modify the \fIlocal_iov\fR or its content until the DTO is
completed. When a Consumer does not adhere to this rule, the behavior of the
Provider and the underlying Transport is not defined. Providers that allow
Consumers to get ownership of the \fIlocal_iov\fR but not the memory it
specified back after the \fBdat_ep_post_recv()\fR returns should document this
behavior and also specify its support in Provider attributes. This behavior
allows Consumer full control of the \fIlocal_iov\fR content after
\fBdat_ep_post_recv()\fR returns. Because this behavior is not guaranteed by
all Providers, portable Consumers should not rely on this behavior. Consumers
should not rely on the Provider copying \fIlocal_iov\fR information.
.sp
.LP
The \fBDAT_SUCCESS\fR return of the \fBdat_ep_post_recv()\fR is at least the
equivalent of posting a Receive operation directly by native Transport.
Providers should avoid resource allocation as part of \fBdat_ep_post_recv()\fR
to ensure that this operation is nonblocking and thread safe for an UpCall.
.sp
.LP
If the size of an incoming message is larger than the size of the
\fIlocal_iov\fR, the reported status of the posted Receive DTO in the
corresponding Completion DTO event is \fBDAT_DTO_LENGTH_ERROR\fR. If the
reported status of the Completion DTO event corresponding to the posted Receive
DTO is not \fBDAT_DTO_SUCCESS\fR, the content of the \fIlocal_iov\fR is not
defined.
.sp
.LP
The operation is valid for all states of the Endpoint. The actual data transfer
does not take place until the Endpoint is in the \fBDAT_EP_STATE_CONNECTED\fR
state. The operation on the Endpoint in \fBDAT_EP_STATE_DISCONNECTED\fR is
allowed. If the operation returns successfully, the posted Recv is immediately
flushed to \fIrecv_evd_handle\fR.
.SH RETURN VALUES
.ne 2
.na
\fB\fBDAT_SUCCESS\fR\fR
.ad
.RS 30n
The operation was successful.
.RE

.sp
.ne 2
.na
\fB\fBDAT_INSUFFICIENT_RESOURCES\fR\fR
.ad
.RS 30n
The operation failed due to resource limitations.
.RE

.sp
.ne 2
.na
\fB\fBDAT_INVALID_PARAMETER\fR\fR
.ad
.RS 30n
Invalid parameter. For example, one of the IOV segments pointed to a memory
outside its LMR.
.RE

.sp
.ne 2
.na
\fB\fBDAT_INVALID_HANDLE\fR\fR
.ad
.RS 30n
The \fIep_handle\fR parameter is invalid.
.RE

.sp
.ne 2
.na
\fB\fBDAT_PROTECTION_VIOLATION\fR\fR
.ad
.RS 30n
Protection violation for local or remote memory access. Protection Zone
mismatch between an LMR of one of the \fIlocal_iov\fR segments and the local
Endpoint.
.RE

.sp
.ne 2
.na
\fB\fBDAT_PRIVILEGES_VIOLATION\fR\fR
.ad
.RS 30n
Privileges violation for local or remote memory access. One of the LMRs used in
\fIlocal_iov\fR was either invalid or did not have the local read privileges.
.RE

.SH USAGE
.LP
For best Recv operation performance, the Consumer should align each buffer
segment of \fIlocal_iov\fR to the Optimal Buffer Alignment attribute of the
Provider. For portable applications, the Consumer should align each buffer
segment of \fIlocal_iov\fR to the \fBDAT_OPTIMAL_ALIGNMENT\fR.
.SH ATTRIBUTES
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Standard: uDAPL, 1.1, 1.2
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.LP
.BR libdat (3LIB),
.BR attributes (7)
